Skip to content

Add BlockContext::float_snapshot/restore_float_snapshot for speculative float placement - #1068

Draft
nicoburns wants to merge 1 commit into
devin/1786127796-float-zero-heightfrom
devin/1786127796-float-snapshot
Draft

Add BlockContext::float_snapshot/restore_float_snapshot for speculative float placement#1068
nicoburns wants to merge 1 commit into
devin/1786127796-float-zero-heightfrom
devin/1786127796-float-snapshot

Conversation

@nicoburns

@nicoburns nicoburns commented Aug 7, 2026

Copy link
Copy Markdown
Member

Objective

Part 5/5 of the float placement fixes split from #1063 (stacked on #1067).

Adds a small public API for callers integrating inline layout (e.g. Blitz):

impl BlockContext<'_> {
    pub fn float_snapshot(&self) -> FloatContext;
    pub fn restore_float_snapshot(&mut self, snapshot: FloatContext);
}

An inline layout engine may need to place a float mid-line before knowing whether the line's content fits beside it (e.g. white-space: nowrap or unbreakable content discovered later on the line). The snapshot lets it speculatively place floats and roll them back if the line must be re-laid without them. DioxusLabs/blitz#628 currently pins #1067's head (so its revocable-float logic is temporarily removed); re-adding it on top of this API fixes WPT float-nowrap-3/9.html there.

Feedback wanted

This is a pragmatic clone/restore API; happy to reshape it (e.g. a transactional guard type) if preferred.

Context

Stack (bottom-up): rules 3&7 overflow (#1064) → margin collapse (#1065) → height-aware slots (#1066) → zero-height floats (#1067) → this PR. Together they supersede #1063 (closed). Latest WPT verification: blitz css/CSS2/floats+floats-clear = 246 PASS / 91 FAIL / 0 CRASH of 337 with #1066+#1067 + DioxusLabs/blitz#628 (19 newly passing vs blitz main's 227/110/0; +2 more — float-nowrap-3/9 — with this PR's API used).

Link to Devin session: https://app.devin.ai/sessions/2aa49a15ca484966b5b71922bfd2bb58
Requested by: @nicoburns

@nicoburns nicoburns self-assigned this Aug 7, 2026
@devin-ai-integration

Copy link
Copy Markdown
Contributor

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR that start with 'DevinAI' or '@devin'.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment, CI, and merge conflict monitoring

@nicoburns
nicoburns force-pushed the devin/1786127796-float-snapshot branch from 473b3fa to 6b00476 Compare August 21, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant